Skip to content

security: dev databases are published on every interface without credentials - #782

Open
Shengcun-Scanner wants to merge 1 commit into
marcj:masterfrom
Shengcun-Scanner:shengcun/loopback-dev-databases
Open

Shengcun-Scanner wants to merge 1 commit into
marcj:masterfrom
Shengcun-Scanner:shengcun/loopback-dev-databases

Conversation

@Shengcun-Scanner

Copy link
Copy Markdown

The dev/test stack publishes its databases on every interface:

postgres:  ports: ['5432:5432']    # POSTGRES_HOST_AUTH_METHOD: trust
mysql:     ports: ['3306:3306']    # MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
mongo:     ports: ['27017:27017']  # no auth
mongo-auth: ports: ['27018:27017'] # root:root
redis:     ports: ['6379:6379']    # no auth

docker compose up -d therefore listens on 0.0.0.0, and everything on the same
network can connect to a database that has no password (postgres trust, mysql
empty root, mongo unauthenticated, redis unauthenticated) or to the known
root:root of the auth test instance. That is a real exposure on any machine
that is not a single-user laptop on a trusted LAN, and it costs nothing to close:
the tests connect to localhost, which a loopback binding serves identically.

Each port is now published as 127.0.0.1:<port>:<port>; container-to-container
traffic is unaffected because it uses the compose network, not the published port.

Verified with the compose parser:

$ docker compose config >/dev/null && echo OK
OK
$ docker compose config | grep -c 'host_ip: 127.0.0.1'
5

Co-Authored-By: Shengcun <business@rs-systems-web.com>
@Shengcun-Scanner
Shengcun-Scanner force-pushed the shengcun/loopback-dev-databases branch 2 times, most recently from c9b7aff to 932783f Compare November 17, 2026 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants